JavaScript systems are becoming increasingly complex and large. To tackle thechallenges involved in implementing these systems, the language is evolving toinclude several constructions for programming- in-the-large. For example,although the language is prototype-based, the latest JavaScript standard, namedECMAScript 6 (ES6), provides native support for implementing classes. Eventhough most modern web browsers support ES6, only a very few applications usethe class syntax. In this paper, we analyze the process of migrating structuresthat emulate classes in legacy JavaScript code to adopt the new syntax forclasses introduced by ES6. We apply a set of migration rules on eight legacyJavaScript systems. In our study, we document: (a) cases that arestraightforward to migrate (the good parts); (b) cases that require manual andad-hoc migration (the bad parts); and (c) cases that cannot be migrated due tolimitations and restrictions of ES6 (the ugly parts). Six out of eight systems(75%) contain instances of bad and/or ugly cases. We also collect theperceptions of JavaScript developers about migrating their code to use the newsyntax for classes.
展开▼